# -*- coding: UTF-8 -*-
'''
Created on 2018年3月21日

@author: wqp0010@gmail.com
'''
import socket


serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

host = socket.gethostname()

port = 9999

serversocket.bind((host, port))

serversocket.listen(5)
print("启动成功, 监听端口号：%d" % port)
while True:
    clientsocket,addr = serversocket.accept()
    
    print("连接地址: %s" % str(addr))
    
    msg = "Welcome, " + str(addr) + "\r\n"
    
    clientsocket.send(msg.encode("utf-8"))
    clientsocket.close()
    